package com.wanshi.utils;


import com.wanshi.po.Record;
import com.wanshi.po.Result;
import com.wanshi.po.User;
import com.wanshi.service.RecordService;

import javax.servlet.http.HttpSession;

public class RequestUtils {

    public static Result getResult(RecordService recordService, Record record, boolean flag) {
        if (flag) {
            record.setResult(1);
        } else {
            record.setResult(0);
        }
        //recordService.addRecord(record);
        return new Result(record.getResult());
    }

    public static Record getRecord(HttpSession session, int id, String content) {
        User user =  (User)session.getAttribute("user");
        Integer user_id = user.getId();
        return new Record(id,user_id, content);
    }
}
